package com.lanyou.esb.redis.proxy.impl;

import java.io.IOException;

import org.springframework.stereotype.Service;

import redis.clients.jedis.Jedis;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.lanyou.esb.common.Constants4Redis;
import com.lanyou.esb.redis.proxy.base.BaseListJedisProxy;

/**
 * 接口告警键值Redis操作代理 <br>
 * 
 * @author Davey.wu
 */
@Service
public class IfAlarmKeysJedisProxy extends BaseListJedisProxy<String> {

	public IfAlarmKeysJedisProxy() {
		this.setListKey(Constants4Redis.REDIS_LIST_KEY_IF_ALARM_KEYS);
	}

	public String avgErases(Jedis jedis) {
		return jedis.lpop(this.getListKey());
	}

	public void unErase(Jedis jedis, String target) throws JsonParseException,
			JsonMappingException, IOException {
		jedis.lpush(this.getListKey(), target);
	}

}
